package com.wsc.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultMsg {
    private Integer code; // 状态码
    private String message; // 描述信息
    private Object data; // 数据
    public static ResultMsg success() {
        return success(null);
    }
    // 有需要可自行添加
    public static ResultMsg success(Object data) {
        return new ResultMsg(HttpStatus.OK.value(),"success",data);
    }
    public static ResultMsg error(Integer code, String message) {
        return new ResultMsg(code,message,null);
    }
    public static ResultMsg error(Integer code, Object data) {
        return new ResultMsg(code,null,data);
    }

}
